package com.xb.controller;

import com.xb.entity.GetCardIdInfoReqVO;
import com.xb.entity.MedicalRecord;
import com.xb.service.IMedicalRecordService;
import com.xb.service.IPatientService;
import com.xb.util.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * entityController
 * /api/medicalRecord
 */
@RestController
@RequestMapping("/api/medicalRecord")
public class MedicalRecordController {
    @Autowired
    private IMedicalRecordService medicalRecordService;
    @Autowired
    private IPatientService patientService;

    @RequestMapping("/page")
    @RequiresPermissions("system:medicalRecord:page")
    public Object findPage(MedicalRecord obj, @RequestParam(value = "pageNum", defaultValue = "1") Integer page,
                           @RequestParam(value = "pageSize", defaultValue = "10") Integer limit) {
        return medicalRecordService.selectMedicalRecordList(obj, page, limit);
    }

    @PostMapping("/getCardIdInfo")
    public Result getCardIdInfo(@RequestBody GetCardIdInfoReqVO getCardIdInfoReqVO, HttpSession session) {
        return patientService.medicalRecordGetCardIdInfo(getCardIdInfoReqVO, session);
    }

}
